ngModel [NgModelController#$setValidity]
( type in module ng
)
Change the validity state, and notifies the form when the control changes validity. (i.e. it does not notify form if given validator is already marked as invalid).
This method should be called by validators - i.e. the parser or formatter functions.
NgModelController#$setValidity(validationErrorKey, isValid);
validationErrorKey – {string} –
Name of the validator. the validationErrorKey
will assign
to $error[validationErrorKey]=isValid
so that it is available for data-binding.
The validationErrorKey
should be in camelCase and will get converted into dash-case
for class name. Example: myError
will result in ng-valid-my-error
and ng-invalid-my-error
class and can be bound to as {{someForm.someControl.$error.myError}}
.
isValid – {boolean} –
Whether the current state is valid (true) or invalid (false).